package main

import "fmt"

func main() {
	// 取变量地址
	var i int = 10
	fmt.Println("address of i =", &i)

	fmt.Println("--------------------------------")

	// 定义指针变量
	var p *int = &i
	fmt.Println("value of p =", p)
	fmt.Println("value stored in p =", *p)

	// 通过指针修改变量值
	fmt.Println("i =", i)
	*p = 100
	fmt.Println("i =", i)
}
